var xhr
window.onload = function(){
    xhr = createXHR()
}
function opc3(val,pos,tipo,pag){   
        if(pag==1){
            xhr.open("GET", "/SistemaWebAGB_2.0/dinamica/ajax/test.jsp?value="+val.value+"&tipo="+tipo);
             
        }else{
            xhr.open("GET", "/SistemaWebAGB_2.0/dinamica/ajax/test.jsp?value="+val.value+"&tipo="+tipo);
             
        }
        if(pag==3){
             xhr.open("GET", "/SistemaWebAGB_2.0/dinamica/ajax/test.jsp?value="+val.value+"&tipo="+tipo);
        
        }
        xhr.onreadystatechange = function(){
        var content = document.getElementById("content"+pos)
        if(xhr.readyState==4){            
            content.innerHTML = xhr.responseText
        }
        //else{
           // content.innerHTML = img;
        //}
    }
    xhr.send(null);
}
 function createXHR(){
     if(window.XMLHttpRequest){
         return new XMLHttpRequest()//FF, GCH, OP, etc
     }else if(window.ActiveXObject){
         return new ActiveXObject("Microsoft.XMLHTTP")//IE
     }else{
         alert("AJAX no funciona :)")
         return null
     }
 }